package com.kgcx.coupon.controller;

import com.kgcx.common.bean.RequestData;
import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.coupon.domain.Punish;
import com.kgcx.coupon.service.PunishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @author zhulong
 */
@Api(description = "处罚接口", tags = "处罚接口")
@RestController
@RequestMapping("complain")
public class PunishController extends BaseController {

    @Autowired
    private PunishService punishService;

    @ApiOperation(value = "处罚", httpMethod = "POST", notes = "这是发起对某个订单编号投诉的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "licenseId", value = "驾驶证编号", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "punishReason", value = "处罚原因", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "punishResult", value = "处罚结果", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class)

    })
    @PostMapping("addPunish")
    public ReturnData<Integer> addPunish(String licenseId,String punishReason, String punishResult) {
        ReturnData<Integer> returnData = ReturnData.getResult();
        Integer one = punishService.addPunish(licenseId,punishReason,punishResult);
        returnData.setData(one);
        return returnData;
    }
    /**
     * 专给监管平台提供查询
     */
    @ApiOperation(value = "监管平台查询处罚信息", httpMethod = "GET", notes = "这是用来给监管平台查询处罚信息的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "页容量", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "orderBy", value = "排序,sql格式", required = false, paramType = "query", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "kid", value = "主键ID", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "licenseId", value = "驾驶证号", required = false, paramType = "query", dataType = "String", dataTypeClass = String.class)
    })
    @GetMapping("queryPunishWithPage")
    public ReturnData<List<Punish>> queryPunishWithPage() {
        RequestData rd = this.getRequestData();
        List<Punish> punishList = punishService.queryPunishWithPage(rd);
        return new ReturnData<>(punishList);
    }

}
